package com.aoxon.cargo.component;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.aoxon.cargo.R;
import com.aoxon.cargo.bean.Price;


/**
 * 显示价格项的组件
 * @author ZZJ
 *
 */
public class MyPriceItem {

	private LinearLayout llPriceHolder;
	private LayoutInflater layoutInflater;

	public MyPriceItem(Context context, LinearLayout llPriceHolder) {
		this.layoutInflater = LayoutInflater.from(context);
		this.llPriceHolder = llPriceHolder;
	}

	public void show(List<Price> prices) {
		for (int i = 0; i < prices.size(); i++) {
			final View priceItem = layoutInflater.inflate(
					R.layout.pub_goods_details_price, null);
			final TextView tvPriceOne = (TextView) priceItem
					.findViewById(R.id.tvGoodsDetailsPriceOne);
			tvPriceOne.setVisibility(View.GONE);
			final TextView tvPriceTwo = (TextView) priceItem
					.findViewById(R.id.tvGoodsDetailsPriceTwo);
			tvPriceTwo.setVisibility(View.GONE);
			final TextView tvPriceShow = (TextView) priceItem
					.findViewById(R.id.tvGoodsDetailsPriceShow);
//			tvPriceOne.setText(prices.get(i).getWantNumberFrom());
//			if (Integer.valueOf(prices.get(i).getWantNumberTo()) == -1) {
//				tvPriceTwo.setText("件以上");
//			} else {
//				tvPriceTwo.setText("~" + prices.get(i).getWantNumberTo() + "件");
//			}
			tvPriceShow.setText(String.valueOf(prices.get(i).getPrice()));
			llPriceHolder.addView(priceItem);
		}
	}

}
